#include <iostream>
#include<algorithm>
using namespace std;
const int N = 1e4;
int a[N];
int n, m;
//整数二分
bool check1(int x, int mid)
{
    return a[mid] <= x;
}
void binary_search1(int l, int r, int x)
{
    while (l < r)
    {
        int mid = (r + l + 1) >> 1;
        if (check1(x, mid))  l = mid;
        else    r = mid - 1;
    }
    if (a[l] != x) cout << "-1" << " ";
    else cout << r;
}
int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i];
    while (m--)
    {
        int x;
        cin >> x;
        binary_search1(0, n - 1, x);

    }
    return 0;
}